'''
Created on 23/03/2009

@author: eh01
'''
from yarra.datastore.dst import DST
import unittest

class DSTTest(unittest.TestCase):


    def setUp(self):
        pass


    def tearDown(self):
        pass


    def test_to_xml(self):
        dst = DST(subject="testSubject", predicate="testPredicate", object="testObject")
        xml = dst.to_xml()
        if xml == '<dst><subject>testSubject</subject><predicate>testPredicate</predicate><object>testObject</object><literal></literal><literalType></literalType></dst>':
            assert True
        else:
            self.fail('To XML failed')

    def test_unmarshal(self):
        xml = "<dst>"
        subject = "testSubject"
        predicate = "testPredicate"
        object = "testObject"
        xml += "<subject>" + subject + "</subject>"
        xml += "<predicate>" + predicate + "</predicate>"
        xml += "<object>" + object + "</object>"
        xml += "</dst>"
        dst = DST(xml_string=xml)
        assert subject == dst.subject
        assert predicate == dst.predicate
        assert object == dst.object
        
if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testToXML']
    unittest.main()